import Vue from 'vue'
import "@/assets/iconfont/iconfont.js"
import App from './App.vue'
import router from './router'
import store from './store'
import axios from 'axios'
import user from './store/user'
import "@/assets/reset.css"
import "./components";
import MintUI from 'mint-ui'
import 'mint-ui/lib/style.css'
import { Swipe, SwipeItem } from 'mint-ui';

Vue.use(MintUI)
Vue.prototype.$axios = axios;
Vue.component(Swipe.name, Swipe);
Vue.component(SwipeItem.name, SwipeItem);

//请求拦截
axios.interceptors.request.use(config=>{
  config.url='/api/'+config.url+(config.url.includes("?")?"&":"?")+"t="+Date.now();
  config.headers={
    authorization:store.state.user.token
  }
  return config;
})
axios.interceptors.response.use(({data})=>{
      if(data.ok===-2){
        store.commit("DELETE_PHONE_ID")
      }
      return data
})
Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: function (h) { return h(App) }
}).$mount('#app')
